package com.fitso.model.bean.nutrition;

import java.io.Serializable;

import org.apache.commons.lang.builder.CompareToBuilder;
import org.apache.commons.lang.builder.EqualsBuilder;
import org.apache.commons.lang.builder.HashCodeBuilder;
import org.apache.commons.lang.builder.ReflectionToStringBuilder;

import com.fitso.model.bean.ModelBean;

public class FoodDescription extends ModelBean implements Comparable<FoodDescription>, Serializable {
	// Only change on breaking changes, i.e., removing fields
	private static final long serialVersionUID = 1L;
	
	private String _commonName; // ex. Coffee

	private String _producer; // ex. Starbucks

	private String _productName; // ex. Vanilla Latte

	public FoodDescription() {}

	public FoodDescription(String commonName) {
		_commonName = commonName;
	}

	public FoodDescription(String commonName, String producer, String productName) {
		_commonName = commonName;
		_producer = producer;
		_productName = productName;
	}

	public String getCommonName() {
		return _commonName;
	}

	public String getProducer() {
		return _producer;
	}

	public String getProductName() {
		return _productName;
	}

	public void setCommonName(String commonName) {
		_commonName = commonName;
	}

	public void setProducer(String producer) {
		_producer = producer;
	}

	public void setProductName(String productName) {
		_productName = productName;
	}

	public boolean equals(Object o) {
		if (o == null) {
			return false;
		}
		if (o == this) {
			return true;
		}
		if (o.getClass() != getClass()) {
			return false;
		}

		FoodDescription other = (FoodDescription) o;
		return new EqualsBuilder().append(_commonName, other._commonName).append(_producer, other._producer).append(
				_productName, other._productName).isEquals();
	}

	public int hashCode() {
		return new HashCodeBuilder().append(_commonName).append(_producer).append(_productName).toHashCode();
	}

	public String toString() {
		return new ReflectionToStringBuilder(this).toString();
	}

	@Override
	public int compareTo(FoodDescription other) {
		return new CompareToBuilder().append(_commonName, other._commonName).append(_producer, other._producer).append(
				_productName, other._productName).toComparison();
	}
}
